package com.video.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.common.domain.po.DraftVideoItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 路亚
 * @version 0.1
 * @className DraftVideoItemMapper.xml
 * @description
 * @date 2024/12/11 19:03
 * @since jdk11
 */
@Mapper
public interface DraftVideoItemMapper extends BaseMapper<DraftVideoItem> {
    List<DraftVideoItem> queryByNum(@Param("videoId") Long videoId,
                                    @Param("numList") List<Integer> numList);

    @Delete("delete from draft_video_item where video_id = #{videoId}")
    void deleteByVideoId(Long videoId);

    @Select("select id, video_id, num, video_url, stars from draft_video_item where video_id = #{id}")
    List<DraftVideoItem> selectByVideoId(Long id);

    @Select("select id, video_id, num, video_url, stars from draft_video_item where video_id = #{videoId} and num = #{num}")
    DraftVideoItem selectByVideoIdAndNum(@Param("videoId") Long id,
                                         @Param("num") Integer num);
}
